Release 10.1A: OpenEdge Development:
Programming Interfaces
Reading the contents of a directory
Sometimes, rather than reading the contents of a file, you want to read a list of the files in a directory. You can use the
OS–DIRoption of theINPUTFROMstatement for this purpose.Each line read from
OS–DIRcontains three values:The tokens are returned in the standard Progress format that can be read by the
IMPORTorSETstatements.The following example uses the
OS–GETENVfunction to find the path of theDLCdirectory. It then uses theOS–DIRoption ofINPUT FROMto read the contents of the directory:
In
i-osdir.p, only the base name of the file and attribute string are read fromOS–DIR. The caret (^) is used in theSETstatement to skip over the pathname of the file.For more information on the
OS–DIRoption, see theINPUTFROMStatement reference entry in the OpenEdge Development: Progress 4GL Reference .You can find additional information on a single file by using the
FILE–INFOsystem handle. To use theFILE–INFOhandle, first assign the pathname of an operating system file to theFILE–INFO:FILE–NAMEattribute. You can then read otherFILE–INFOattributes. For example, thei-osfile.pprocedure prompts for the pathname of a file and then uses theFILE–INFOhandle to get information on that file:
For more information, see the
FILE–INFOSystem Handle reference entry in the OpenEdge Development: Progress 4GL Reference .
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |